<?php
class ORMOrderTaskUser extends ORMBase {
  public function __construct() {
    parent::__construct('OrderTaskUser');
  }

  public function __toEpObject($myManager, $epObject, $object) {
    require_once dirname(__FILE__) . '/ORMStatus.class.php';
    require_once dirname(__FILE__) . '/ORMUser.class.php';
    $epObject->trackId = isset($object->trackId) ? $object->trackId : '';
    if (isset($object->assignee) && $object->assignee) {
        $epObject->assignee = $this->__getEpObject_4_lvl_1_object($myManager, $object->assignee, new ORMUser(), 'User');
    } else {
      if (isset($epObject->assignee)) {
        $my_manager->delete($epObject->assignee);
      }
    }
    $epObject->type = isset($object->type) ? $object->type : '';
    $epObject->estimates = isset($object->estimates) ? $object->estimates : 0;
    $epObject->extras = isset($object->extras) ? $object->extras : 0;
    $epObject->travel = isset($object->travel) ? $object->travel : 0;
    $epObject->total = isset($object->total) ? $object->total : 0;
    $epObject->note = isset($object->note) ? $object->note : '';
    if (isset($object->status) && $object->status) {
        $epObject->status = $this->__getEpObject_4_lvl_1_object($myManager, $object->status, new ORMStatus(), 'Status');
    } else {
      if (isset($epObject->status)) {
        $my_manager->delete($epObject->status);
      }
    }
    return $epObject;
  }

  public function __toObject($myManager, $epObject, $object) {
    require_once dirname(__FILE__) . '/ORMStatus.class.php';
    require_once dirname(__FILE__) . '/ORMUser.class.php';
    $object->id = $epObject->oid;
    $object->trackId = $epObject->trackId;
    if (isset($epObject->assignee)) {
      $object->assignee = $this->__getObject_4_lvl_1_ep_object($myManager, $epObject->assignee, new ORMUser());
    }
    $object->type = $epObject->type;
    $object->estimates = $epObject->estimates;
    $object->extras = $epObject->extras;
    $object->travel = $epObject->travel;
    $object->total = $epObject->total;
    $object->note = $epObject->note;
    if (isset($epObject->status)) {
      $object->status = $this->__getObject_4_lvl_1_ep_object($myManager, $epObject->status, new ORMStatus());
    }
    return $object;
  }
}
?>
